package com.chaos.framework.starter.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MybatisPlusTenantConfig implements WebMvcConfigurer {

    @Bean
    public FilterRegistrationBean<MybaitsPlusTenantFilter> tenantFilterRegistrationBean() {
        FilterRegistrationBean<MybaitsPlusTenantFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new MybaitsPlusTenantFilter());
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }
}
